-
Notifications
You must be signed in to change notification settings - Fork 76
frontend: support "casting" between MLIR types #1825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
24e3542
to
b029d06
Compare
62a87c0
to
e30e535
Compare
57ea506
to
0e41744
Compare
@j2kun / @asraa: I see the cggi-frontend tests fail when doing The error message I get when running with bazel is
|
The techmap error looks like it's an issue with your build file. You'd need something like Ignoring that, it is true that we can't enable CGGI tests right now because we don't have a frontend-compatible backend for it. HEIR doesn't have a CGGI backend via OpenFHE's binfhe yet, and the frontend doesn't support rust for |
Yep, but this is using the CleartextBackend (so just testing down to I'll look into the BUILD file thing you mentioned! |
0e41744
to
1e4dc37
Compare
Tests pass w/ bazel now, so should be good to review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a few nits
* allow cleartext backend for CGGI * allow types.Boolean where types.Integer is expected * add support for `>>`/arith.shrsi * better support for `MLIRType` when running vanilla Python
1e4dc37
to
1dd2708
Compare
The main issues not allowing this to be done in the review for google#1825: - Bare words are treated as a variable capture unless scoped (with a module prefix, e.g., `mt.I1`) or instantiated (`I1()`). - The "MLIRType" values passed to these functions are not actually instances of MLIRType (the type hint is still incorrect in this PR), but rather instances of `class`. We cannot rectify this by instantiating the MLIRType to simplify the match syntax (e.g., use `I1()` instead of `mt.I1`) because google#1825 added a member variable on MLIRType so the type class could be used as a cast. Possibly an improvement would be to add a no-value constructor to MLIRType so that `I1()` can be instantiated as a standalone type, and then call these helpers with actual instances of MLIRType rather than class constructor objects.
Tries to address the use case presented in #1789 though it does so not via type hints but via adding support for casts:
Still WIP: